package com.yh.ldzl.controller;

import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.page.TableDataInfo;
import com.yh.ldzl.domain.*;
import com.yh.ldzl.service.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * 检验单缺陷记录Controller
 *
 * @author yanghuai
 * @date 2025-07-06
 */
@RestController

@RequestMapping("/qc/defectRecord")
public class ScApiController  extends BaseController {

    @Autowired
    private IQcDefectRecordService qcDefectRecordService;

    @Autowired
    private IQcIpqcLineService qcIpqcLineService;

    @Autowired
    private IQcIpqcService qcIpqcService;

    @Autowired
    private IQcIqcService qcIqcService;

    @Autowired
    private IQcOqcService qcOqcService;

    @Autowired
    private IQcRqcService qcRqcService;

    /**
     * 查询缺陷记录列表
     */
    @PostMapping("/selectQcDefectRecord/{qc_id}")
    public TableDataInfo selectQcDefectRecord(@PathVariable Long qc_id)
        {
        startPage();
        List<Map<String, Object>> list = qcDefectRecordService.selectQcDefectRecord(qc_id);
        return getDataTable(list);
    }

    /**
     * 查询过程检验单行列表
     * @param ipqcId
     * @return
     */
    @PostMapping("/selectQcIpqcLineId/{ipqcId}")
    public TableDataInfo selectQcIpqcLineId(@PathVariable Long ipqcId){
        startPage();
        List<QcIpqcLine> list = qcIpqcLineService.selectQcIpqcLineId(ipqcId);
        return getDataTable(list);

    }

    /**
     * 查询过程检验单信息
     * @param qc_id
     * @return
     */
    @PostMapping("/selectQcIpqcId/{qc_id}")
    public QcIpqc selectQcIpqcId(@PathVariable Long qc_id){
        startPage();
        QcIpqc qcIpqc = qcIpqcService.selectQcIpqcSourceDocId(qc_id);
        return qcIpqc;
    }
    /**
     * 查询来料检验单信息
     * @param source_doc_id
     * @return
     */
    @PostMapping("/selectQcIqcId/{source_doc_id}")
    public QcIqc selectQcIqcId(@PathVariable Long source_doc_id){
        startPage();
        QcIqc qcIqc = qcIqcService.selectQcIqcId(source_doc_id);
        return qcIqc;
    }
    /**
     * 获取出货检验单详情
     * @param source_doc_code
     * @return
     */
    @PostMapping("/selectQcOqcListSourceDocId/{source_doc_code}")
    public QcOqc selectQcOqcListSourceDocId(@PathVariable Long source_doc_code){
        startPage();
        QcOqc  qcOqc = qcOqcService.selectQcOqcListSourceDocId(source_doc_code);
        return qcOqc;
    }
    /**
     * 获取退料检验单
     * @param source_doc_code
     * @return
     */
    @PostMapping("/selectQcRqcListSourceDocId/{source_doc_code}")
    public QcRqc selectQcRqcListSourceDocId(@PathVariable Long source_doc_code){
        startPage();
        QcRqc  qcRqc = qcRqcService.selectQcRqcListSourceDocId(source_doc_code);
        return qcRqc;
    }

}
